package com.dylan.springcloud.common.util;

import org.apache.commons.lang3.time.DateFormatUtils;

import java.util.Date;

/**
 * Created by Dylan on 2018/9/18.
 */
public class LogUtil {

    public static void info(Object message) {
        String datetime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
        String threadName = Thread.currentThread().getName();
        System.out.println("[" + datetime + " " + threadName + "] - " + String.valueOf(message));
    }

    public static void error(Throwable throwable) {
        String datetime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS");
        String threadName = Thread.currentThread().getName();
        System.err.println("[" + datetime + " " + threadName + "] - " + throwable.getMessage());
    }

    public static void logCuttingLine() {
        System.out.println("-----------------------------------------------------------------------------");
    }
}
